package com.glsc.ngateway.common.base.dto.opmanage.report.auth;

import com.glsc.ngateway.common.base.domain.mysql.gateway.platform.User;
import org.springframework.util.StringUtils;

import java.text.MessageFormat;

/**
 * @author: qiyr
 * @date: 2022/6/14 09:56
 * @description: 用户基本信息
 */
public class UserBaseInfoDto {

    private Long id;

    private String username;

    private String name;

    private String department;

    private String email;

    public UserBaseInfoDto() {
    }

    public UserBaseInfoDto(User user) {
        this.id = user.getId();
        this.username = user.getUsername();
        this.name = StringUtils.hasText(user.getName()) ? user.getName() : user.getUsername();
        this.department = user.getUserDepartment();
        this.email = MessageFormat.format("{0}<{1}>", this.name, user.getEmail());
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDepartment() {
        return department;
    }

    public void setDepartment(String department) {
        this.department = department;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }
}
